package com.eyas.software.pattern.eventbus.register;

import com.eyas.software.pattern.eventbus.event.Event;
import com.eyas.software.pattern.eventbus.subscriber.Subscriber;

import java.util.List;

/**
 * 订阅者注册器
 */
public interface Register {
    /**
     * 订阅
    *
     * @param event
     * @param subscriber
     */
    void register(Event event, Subscriber subscriber);

    /**
     * 取消订阅
     *
     * @param event
     * @param subscriber
     */
    void unregister(Event event, Subscriber subscriber);

    /**
     * 获取event对应的所有订阅者
     * @param event
     * @return
     */
    List<Subscriber> getSubscribers(Event event);
}
